home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
A.D. Software
/
OOFILE
/
Buildable, limited OOFILE
/
samples
/
ooftst09.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-14
|
1KB
|
50 lines
// Copyright 1994 A.D. Software. All Rights Reserved
// OOFTEST9
// this sample deletes records including related data
// Simple stream I/O is used to interact with the user.
#include "oofile.hpp"
#include "ooftst02.inc"
int main()
{
cout << "OOFILE Validation Suite - Test 9\n"
<< "Simple test to demonstrate deleting records" << endl
<< "using the database from ooftst02" << endl;
if (dbConnect::fileExists("ooftst09.db"))
theDB.openConnection("ooftst09.db");
else {
theDB.newConnection("ooftst09.db");
}
Patients.AddTestData(); // always add data - file is empty from last run if it exists
cout << "Entire database before deletions" << endl << theDB << endl;
dbView smithVisits(Patients.Visits);
smithVisits << Patients.Visits->VisitDate << Patients.Visits->Why;
Patients.search(Patients.LastName=="Smith");
cout << "Dumping Smith and his visits: " << endl
<< Patients << endl
<< smithVisits << endl;
cout << "Deleting Smith" << endl;
Patients.deleteRecord();
cout << "Entire database without Smith" << endl << theDB << endl;
cout << "Deleting all remaining records" << endl;
Patients.deleteAll();
cout << "Entire database - should be empty" << endl << theDB << endl;
cout << "done" << endl;
return EXIT_SUCCESS;
}